﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using NutriLeaf.Web.Core.Friends;

namespace NutriLeaf.Services.Core.Friends
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "FriendService" in code, svc and config file together.
    public class FriendService : IFriendService
    {

        NutriLeaf.Web.Model.NutriLeafDBEntities context = new Web.Model.NutriLeafDBEntities();

        public List<int> GetFacebookFriendsID(string accessToken)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetFacebookFriendsID(accessToken);
        }

        public List<int> GetRegisteredFacebookFriendsID(string accessToken)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetRegisteredFacebookFriendsID(accessToken, ref context);
        }

        public void SendFriendRequestToFacebookFriends(string accessToken)
        {
            NutriLeaf.Web.Core.Friends.Friends.SendFriendRequestToFacebookFriends(accessToken, ref context);
        }

        public void SendFriendRequest(int user1Id, int user2Id)
        {
            NutriLeaf.Web.Core.Friends.Friends.SendFriendRequest(user1Id, user2Id, ref context);
        }

        public List<Web.Model.Friend> GetPendingFriendRequestRelationships(int userId)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetPendingFriendRequestRelationships(userId, ref context);
        }

        public List<Web.Core.Account.UserData> GetPendingFriendRequestUserData(int userId)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetPendingFriendRequestUserData(userId, ref context);
        }

        public List<Web.Model.Friend> GetAwaitingApprovalFriendRequestRelationships(int userId)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetAwaitingApprovalFriendRequestRelationships(userId, ref context);
        }

        public List<Web.Core.Account.UserData> GetAwaitingApprovalRequestUserData(int userId)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetAwaitingApprovalRequestUserData(userId, ref context);
        }

        public void AcceptFriendRequest(int user1Id, int user2Id)
        {
           NutriLeaf.Web.Core.Friends.Friends.AcceptFriendRequest(user1Id, user2Id, ref context);
        }

        public void AcceptFriendRequest(Web.Model.Friend friend)
        {
            NutriLeaf.Web.Core.Friends.Friends.AcceptFriendRequest(friend, ref context);
        }

        public void IgnoreFriendRequest(Web.Model.Friend friend)
        {
            NutriLeaf.Web.Core.Friends.Friends.IgnoreFriendRequest(friend, ref context);
        }

        public void IgnoreFriendRequest(int user1Id, int user2Id)
        {
            NutriLeaf.Web.Core.Friends.Friends.IgnoreFriendRequest(user1Id, user2Id, ref context);
        }

        public Web.Model.Friend GetFriendRelationship(int user1Id, int user2Id)
        {
            return NutriLeaf.Web.Core.Friends.Friends.GetFriendRelationship(user1Id, user2Id, ref context);
        }

        public void AcceptAllPendingRequests(List<Web.Model.Friend> friends)
        {
            NutriLeaf.Web.Core.Friends.Friends.AcceptAllPendingRequests(friends, ref context);
        }

        public void AcceptAllPendingRequests(int userId)
        {
            NutriLeaf.Web.Core.Friends.Friends.AcceptAllPendingRequests(userId, ref context);
        }

        public void IgnoreAllPendingRequests(int userId)
        {
            NutriLeaf.Web.Core.Friends.Friends.IgnoreAllPendingRequests(userId, ref context);
        }

        public void IgnoreAllPendingRequests(List<Web.Model.Friend> friends)
        {
            NutriLeaf.Web.Core.Friends.Friends.IgnoreAllPendingRequests(friends, ref context);
        }

        public bool FriendRequestExists(int User1Id, int User2Id)
        {
            return NutriLeaf.Web.Core.Friends.Friends.FriendRequestExists(User1Id, User2Id, ref context);
        }
    }
}
